<template>
  <view class="container">
    <view class="main">
      <view class="main_box">
        <image src="/static/taotaitupian/uitexun.png" mode=""></image>
        <view class="main_box_m">
          <view class="main_box_m_t">
            还在为教资高语笔试发愁？
            <view class="main_box_m_des ellipsis2">
              此处为课程描述，很多很多很多很...
            </view>
          </view>
          <view class="main_box_m_price">
            <text>￥</text>
            <view>666</view>
          </view>
        </view>
      </view>
      <view class="main_footer" @click="open">
        <view class="main_footer_left">
          优惠券
        </view>
        <view class="main_footer_right">
          5张可用
          <uv-icon name="arrow-right" size="22" color="#333" bold></uv-icon>
        </view>
      </view>
    </view>

    <view class="footer_fixed">
      <view class="footer_left">
        <text>合计金额：</text>
        <view>
          <text>￥</text>
          <view>666</view>
        </view>
      </view>
      <view class="footer_right flex-center" @tap="gotoUrl">
        去支付
      </view>
    </view>
    <uv-popup ref="popupRef" mode="bottom" closeable round="20" @change="change" custom-style="height: 836rpx;">
      <view class="pop_title">
        优惠券
      </view>
      <view class="pop_main">
        <uv-tabs :list="popList" :lineWidth="110" :line-height="3" :activeStyle="{
          'font-weight': 'bold',
          'font-size': '32rpx',
          color: '#333333',
        }" :inactiveStyle="{
          'font-size': '28rpx',
          color: '#666666',
        }" :scrollable="false"></uv-tabs>
        <scroll-view scroll-y class="pop_scroll">
          <view class="pop_box" v-for="(item,index) in couponList" :key="index">
            <view class="pop_box_content">
              <image src="/static/deatils/keyongcouponlin.png" mode=""></image>
              <view class="content_left">
                <view class="">
                  <text>￥</text>
                  <view>200</view>
                </view>
                <text>满300元使用</text>
              </view>
              <view class="content_right">
                <view class="">
                  <view class="content_right_head">
                    全场新品课程可用全场可用全场
                  </view>
                  <view class="content_right_des">
                    自领取起3日内有效
                  </view>
                </view>
                <view class="content_right_footer" @click="item.type = !item.type">
                  <view>
                    使用规则
                    <uv-icon v-if="item.type" name="arrow-up" size="12" color="#999"></uv-icon>
                    <uv-icon v-else name="arrow-down" size="12" color="#999"></uv-icon>
                  </view>
                  <button>立即使用</button>
                </view>
              </view>
            </view>
            <view class="pop_box_footer" v-if="!item.type">
              满300元全场新品课程可用
            </view>
          </view>
          <view style="width: 100%;height: 100rpx;">
            
          </view>
        </scroll-view>
      </view>
    </uv-popup>
  </view>
</template>

<script lang="ts" setup>
  import { ref } from 'vue';

  const gotoUrl = () => {
    uni.navigateTo({
      url: '/pages/course/course'
    })
  }

  const popList = ref([
    {
      name: '可用优惠券',
    }, {
      name: '不可用优惠券',
    },
  ])
  const couponList = ref([{
    type: false,
  }, {
    type: true,
  }, {
    type: false,
  }])
  const popupRef = ref()
  const open = () => {
    popupRef.value.open();
  }
  const change = (e) => {
    console.log('弹窗状态改变：', e);
  }
</script>

<style scoped lang="less">
  .container {
    height: 100%;
    padding: 30rpx;
    box-sizing: border-box;
  }

  .pop_main {
    width: 750rpx;
    height: 736rpx;
    background: #FFFFFF;
    border-radius: 20rpx 20rpx 0rpx 0rpx;

  }
  .pop_scroll {
    border-top: 1rpx solid rgba(#000, .1);
    padding: 20rpx 0 50rpx ;
    box-sizing: border-box;
    height: 650rpx;
  }

  .pop_box {
    margin: 30rpx 30rpx 0;
    &:last-child{
      margin-bottom: 100rpx;
    }
  }



  .pop_title {
    height: 100rpx;
    width: 100%;
    text-align: center;
    font-weight: bold;
    font-size: 36rpx;
    color: #333333;
    line-height: 100rpx;
  }

  .pop_box_content {
    width: 690rpx;
    height: 180rpx;
    background: #FFFFFF;
    box-shadow: 0rpx 4rpx 13rpx 0rpx rgba(0, 0, 0, 0.08);
    border-radius: 20rpx;
    position: relative;
    display: flex;

    >image {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
    }

    .content_left {
      position: relative;
      z-index: 9;
      font-size: 32rpx;
      color: #FFFFFF;
      width: 209rpx;
      height: 180rpx;
      border-radius: 20rpx;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      padding: 45rpx 0;
      box-sizing: border-box;

      view {
        display: flex;
        align-items: flex-end;
        font-weight: bold;
      }

      text {
        font-size: 24rpx;
      }
    }


  }

  .pop_box_footer {
    width: 690rpx;
    background: #FFFFFF;
    box-shadow: 0rpx 4rpx 13rpx 0rpx rgba(0, 0, 0, 0.08);
    border-radius: 0 0 20rpx 20rpx;
    padding: 25rpx 30rpx;
    box-sizing: border-box;
    font-size: 24rpx;
    color: #666666;
  }

  .content_right {
    flex: 1;
    position: relative;
    z-index: 9;
    font-size: 24rpx;
    color: #999999;
    padding: 20rpx;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    &_head {
      font-size: 28rpx;
      color: #333333;
      margin-bottom: 5rpx;
    }

    &_footer {
      display: flex;
      justify-content: space-between;
      align-items: center;

      >view {
        display: flex;
        align-items: center;

        .uv-icon {
          margin-left: 5rpx;
        }
      }

      button {
        width: 133rpx;
        height: 47rpx;
        border-radius: 24rpx;
        border: 1px solid #F97135;
        color: #F97135;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        margin: 0;
        font-size: 24rpx;
        padding: 0;

        &::after {
          display: none;
        }
      }
    }
  }

  .main {
    width: 690rpx;
    height: 310rpx;
    background: #FFFFFF;
    border-radius: 16rpx;
    padding: 30rpx 20rpx;
    box-sizing: border-box;

    &_box {
      display: flex;

      image {
        width: 240rpx;
        height: 160rpx;
        background: #999999;
        border-radius: 8rpx;
        margin-right: 20rpx;
      }

      &_m {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        flex: 1;

        &_t {
          font-weight: bold;
          font-size: 30rpx;
          color: #333333;
        }

        &_des {
          font-size: 24rpx;
          color: #666666;
        }

        &_price {
          display: flex;
          font-weight: bold;
          font-size: 24rpx;
          color: #FA4058;
          margin-top: 20rpx;

          view {
            font-size: 32rpx;
          }
        }
      }
    }

    &_footer {
      display: flex;
      justify-content: space-between;
      font-size: 28rpx;
      color: #333333;
      padding-top: 20rpx;
      border-top: 1rpx solid rgba(#000, .1);
      margin-top: 28rpx;

      &_right {
        display: flex;
        align-items: center;
        color: #FA4058;
        font-size: 26rpx;
        color: #FA4058;

        .uv-icon {
          margin-left: 20rpx;
        }
      }
    }
  }

  .footer_fixed {
    width: 750rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #FFFFFF;
  }

  .footer_left {
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 24rpx;
    color: #333333;

    >view {
      display: flex;
      align-items: center;
      color: #FA4058;

      >view {
        font-size: 32rpx;
      }
    }
  }

  .footer_right {
    width: 240rpx;
    height: 68rpx;
    background: #218CFE;
    border-radius: 34rpx;
    font-size: 28rpx;
    color: #FFFFFF;
  }
</style>